package com.lac.xaboa.db;

import android.database.sqlite.SQLiteDatabase;

import java.util.Map;

import de.greenrobot.dao.AbstractDao;
import de.greenrobot.dao.AbstractDaoSession;
import de.greenrobot.dao.identityscope.IdentityScopeType;
import de.greenrobot.dao.internal.DaoConfig;

import com.lac.xaboa.db.model.Member;
import com.lac.xaboa.db.model.Notice;
import com.lac.xaboa.db.model.Flow;
import com.lac.xaboa.db.model.FlowLog;
import com.lac.xaboa.db.model.PushLog;

import com.lac.xaboa.db.dao.MemberDao;
import com.lac.xaboa.db.dao.NoticeDao;
import com.lac.xaboa.db.dao.FlowDao;
import com.lac.xaboa.db.dao.FlowLogDao;
import com.lac.xaboa.db.dao.PushLogDao;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.

/**
 * {@inheritDoc}
 * 
 * @see de.greenrobot.dao.AbstractDaoSession
 */
public class DaoSession extends AbstractDaoSession {

    private final DaoConfig memberDaoConfig;
    private final DaoConfig noticeDaoConfig;
    private final DaoConfig flowDaoConfig;
    private final DaoConfig flowLogDaoConfig;
    private final DaoConfig pushLogDaoConfig;

    private final MemberDao memberDao;
    private final NoticeDao noticeDao;
    private final FlowDao flowDao;
    private final FlowLogDao flowLogDao;
    private final PushLogDao pushLogDao;

    public DaoSession(SQLiteDatabase db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
            daoConfigMap) {
        super(db);

        memberDaoConfig = daoConfigMap.get(MemberDao.class).clone();
        memberDaoConfig.initIdentityScope(type);

        noticeDaoConfig = daoConfigMap.get(NoticeDao.class).clone();
        noticeDaoConfig.initIdentityScope(type);

        flowDaoConfig = daoConfigMap.get(FlowDao.class).clone();
        flowDaoConfig.initIdentityScope(type);

        flowLogDaoConfig = daoConfigMap.get(FlowLogDao.class).clone();
        flowLogDaoConfig.initIdentityScope(type);

        pushLogDaoConfig = daoConfigMap.get(PushLogDao.class).clone();
        pushLogDaoConfig.initIdentityScope(type);

        memberDao = new MemberDao(memberDaoConfig, this);
        noticeDao = new NoticeDao(noticeDaoConfig, this);
        flowDao = new FlowDao(flowDaoConfig, this);
        flowLogDao = new FlowLogDao(flowLogDaoConfig, this);
        pushLogDao = new PushLogDao(pushLogDaoConfig, this);

        registerDao(Member.class, memberDao);
        registerDao(Notice.class, noticeDao);
        registerDao(Flow.class, flowDao);
        registerDao(FlowLog.class, flowLogDao);
        registerDao(PushLog.class, pushLogDao);
    }
    
    public void clear() {
        memberDaoConfig.getIdentityScope().clear();
        noticeDaoConfig.getIdentityScope().clear();
        flowDaoConfig.getIdentityScope().clear();
        flowLogDaoConfig.getIdentityScope().clear();
        pushLogDaoConfig.getIdentityScope().clear();
    }

    public MemberDao getMemberDao() {
        return memberDao;
    }

    public NoticeDao getNoticeDao() {
        return noticeDao;
    }

    public FlowDao getFlowDao() {
        return flowDao;
    }

    public FlowLogDao getFlowLogDao() {
        return flowLogDao;
    }

    public PushLogDao getPushLogDao() {
        return pushLogDao;
    }

}
